<?php
include_once '../business/category_manager.php';
include_once '../entity/category_entity.php';

$categoryUpdate = New CategoryMng();
$categoryEntity = New CategoryEntity();

$categoryEntity->id         =$_POST[id];
$categoryEntity->category   =$_POST[category];
$categoryEntity->parentID   =$_POST[parentID];
$categoryEntity->inTime     =$_POST[inTime];
$categoryEntity->inUser     =$_POST[inUser];

if($categoryUpdate->update($categoryEntity)){
    if($_POST[id] == -1){
        echo "<script>alert('Add successful!')</script>";
    }else{
        echo "<script>alert('update successful!')</script>";
    }
    echo $_POST[page];
    echo "<script>window.location='categoryList.php?page=$_POST[page]'</script>";
}

?>
